<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        form {
            border: 1px solid red;
            padding: 20px;
        }
        .form-row {
            width: 300px;
            border: 1px solid green;
        }

        .form-row>input {
            width: calc(100% - 0.5em);
        }
    </style>
</head>
<body>
    
    <form action="#">
        <div class="form-row">
            <label for="username">用户名</label>
            <input id="username" type="text">
        </div>
    </form>
</body>
</html>